<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<div th:fragment="head">
    <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button> <a class="navbar-brand" th:href="@{/index}"/>主页</a>
        </div>

        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <span th:if="${session.session_user!=null}">
                <ul class="nav navbar-nav">
                    <li class="active">
                        <a th:href="@{/post}" data-toggle="modal">发帖</a>
                    </li>
                </ul>
            </span>
            <form class="navbar-form navbar-left" role="search">
                <div class="form-group">
                    <input type="text" class="form-control" />
                </div> <button type="submit" class="btn btn-default">搜索</button>
            </form>
            <ul class="nav navbar-nav navbar-right">
                <span th:if="${session.session_user==null}">
                    <li class="active">
                        <a class="navbar-brand" th:href="@{/login}" data-toggle="modal">登陆&nbsp&nbsp&nbsp&nbsp</a>
                    </li>
                </span>
                <span th:if="${session.session_user!=null}">
                    <li class="dropdown">
                        <br/><a href="#" class="dropdown-toggle" data-toggle="dropdown"><span th:text="${session.session_user.username}"></span><strong class="caret"></strong></a>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                        <ul class="dropdown-menu">
                            <li>
                                <a th:href="@{/userdetails}">修改用户名</a>
                            </li>
                            <li>
                                <a href="#">我的关注</a>
                            </li>
                            <li class="divider">
                            </li>
                            <li>
                                <a th:href="@{/quit}">退出</a>
                            </li>
                        </ul>
                    </li>
                </span>
            </ul>
        </div>
    </nav>
</div>
</html>